package com.blb.zy_community.controller;

import com.blb.zy_community.utils.CodeUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class CaptchaController {

    @GetMapping("/getCode")
    public Map<String,String> getCode(){
        String code = CodeUtils.generateCaptcha();
        String image = CodeUtils.generateImage(code);
        Map<String, String> result =  new HashMap<>();
        result.put("code",code);
        result.put("image",image);
        return result;
    }
}
